package com.netease.nie.dao;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.netease.nie.mapper.CreditMapper;
import com.netease.nie.model.Credit;

/**
 * 
 * @author KingsHunter
 * @createDate July 1st,2016
 *
 */
@Repository
public class CreditDao {

	@Resource
	private CreditMapper creditMapper;
	
	public Credit forceQueryUserCreditByUserId(long userId){
		return creditMapper.queryUserCreditByUserId(userId);
	}
	
	public int deductUserCredit(Credit credit) throws Exception {
		return creditMapper.deductUserCredit(credit);
	}
	
	public Long insertUserCredit(Credit credit) throws Exception {
		return creditMapper.insertUserCredit(credit);
	}
	
	public int giftUserCredit(Credit credit) throws Exception {
		return creditMapper.giftUserCredit(credit);
	}
	
	public int addUserCredit(Credit credit) throws Exception {
		return creditMapper.addUserCredit(credit);
	}
	
	public int deductAndAddUserCredit(Credit credit) throws Exception {
		return creditMapper.deductAndAddUserCredit(credit);
	}
	
}
